/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.router.core.domain;

import info.peigen.hotpot.business.router.facade.Channel;
import info.peigen.hotpot.business.router.facade.enums.WithdrawStatus;
import info.peigen.hotpot.business.router.facade.order.withdraw.detail.WithdrawDetail;
import info.peigen.hotpot.common.core.domain.DomainObject;
import info.peigen.hotpot.common.core.domain.order.Order;
import info.peigen.hotpot.common.core.lang.money.Money;
import info.peigen.hotpot.common.core.util.IdUtil;
import jakarta.validation.constraints.NotEmpty;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import java.util.Date;
import java.util.List;

import static info.peigen.hotpot.business.router.facade.enums.WithdrawStatus.INIT;

/**
 * <b>(Withdraw)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/9/26
 */
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class Withdraw extends DomainObject {
    @Builder.Default
    String withdrawId = IdUtil.id();
    /** 交易Id */
    @NotEmpty
    String tradeId;
    /** 批次号 */
    @NotEmpty
    String batchNo;
    /** 渠道订单号 */
    String channelUniId;
    /** 状态 */
    @Builder.Default
    WithdrawStatus status = INIT;
    /** 提现渠道,定义提现的钱从哪里出去 */
    Channel     withdrawChannel;
    /** 提现总金额,到账币种 */
    Money       totalAmount;
    /** 提现成功金额,到账币种 */
    Money       successAmount;
    /** 提现总笔数 */
    Integer     totalCount;
    /** 提现成功笔数 */
    Integer     successCount;
    /** 结算时间 */
    Date        settleDate;
    /** 收费 */
    WithdrawFee fee;
    /** 提现明细 */
    @NotEmpty
    List<WithdrawDetail> details;
    /** 申报订单 */
    List<Order>          orders;
    RouterTransLog       positionTransLog;
    List<RouterTransLog> withdrawTransLogs;
    /** 渠道响应原始报文 */
    String               requestJson;
}
